﻿using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Text.Json.Serialization;

namespace BCMongoEntity.TMS.Location.Driver
{
    public class DriverLocationEntity
    {

        private double logitude;
        private double latitude;

        [JsonIgnore]
        [BsonElement("_id")]
        public ObjectId Id { get; set; }
        /// <summary>
        /// 司机编号
        /// </summary>
        [BsonElement("DriverId")]
        public long DriverId { get; set; }

        /// <summary>
        /// 司机电话
        /// </summary>
        [BsonElement("Phone")]
        public string Phone { get; set; }
        /// <summary>
        /// 所在位置精度
        /// </summary>
        [BsonElement("Longitude")]
        public double Longitude { get { return this.logitude; } set { this.logitude = Math.Round(value, 8); } }
        /// <summary>
        /// 所在位置维度
        /// </summary>
        [BsonElement("Latitude")]
        public double Latitude { get { return this.latitude; } set { this.latitude = Math.Round(value, 8); } }
        /// <summary>
        /// 车牌号
        /// </summary>
        [BsonElement("VehicleNo")]
        public string VehicleNo { get; set; }
        /// <summary>
        /// 车型
        /// </summary>
        [BsonElement("VehicleTypeId")]
        public int VehicleTypeId { get; set; }
        /// <summary>
        /// 车型名称
        /// </summary>
        [BsonElement("VehicleType")]
        public string VehicleType { get; set; }
        /// <summary>
        /// 司机名称
        /// </summary>
        [BsonElement("Name")]
        public string Name { get; set; }
        /// <summary>
        /// 司机头像
        /// </summary>
        [BsonElement("DriverPhotoPath")]
        public string DriverPhotoPath { get; set; }
        /// <summary>
        /// 是否接收指派
        /// </summary>
        [BsonElement("IsAcceptAssign")]
        public bool IsAcceptAssign { get; set; }
        /// <summary>
        /// 车辆长度
        /// </summary>
        [BsonElement("VehicleLength")]
        public decimal VehicleLength { get; set; }
        /// <summary>
        /// 车辆宽度
        /// </summary>
        [BsonElement("VehicleWidth")]
        public decimal VehicleWidth { get; set; }

        /// <summary>
        /// 车辆高度
        /// </summary>
        [BsonElement("VehicleHeight")]
        public decimal VehicleHeight { get; set; }
        /// <summary>
        /// 车辆载重
        /// </summary>
        [BsonElement("VehicleWeight")]
        public int VehicleWeight { get; set; }
        /// <summary>
        /// 车辆载货立方
        /// </summary>
        [BsonElement("VehicleStere")]
        public decimal VehicleStere { get; set; }
        /// <summary>
        /// 工作状态
        /// </summary>
        [BsonElement("WorkingStatus")]
        public string WorkingStatus { get; set; }

        /// <summary>
        /// 所在位置精维度
        /// </summary>
        [BsonElement("Coordinate")]
        public double[] Coordinate { get; set; }
        /// <summary>
        /// 所在城市编码
        /// </summary>
        [BsonElement("CityCode")]
        public string CityCode { get; set; }
        /// <summary>
        /// 所在区县编码
        /// </summary>
        [BsonElement("CoutyCode")]
        public string CoutyCode { get; set; }

        /// <summary>
        /// 剩余载重
        /// </summary>
        [BsonElement("SurplusWeight")]
        public int SurplusWeight { get; set; }
        /// <summary>
        /// 位置更新时间
        /// </summary>
        [BsonElement("ModifyTime")]
        [BsonDateTimeOptions(Kind = DateTimeKind.Local)]
        public DateTime ModifyTime { get; set; }
        /// <summary>
        /// 信用值
        /// </summary>
        [BsonElement("CreditScore")]
        public decimal? CreditScore { get; set; }
        /// <summary>
        /// 日接单数
        /// </summary>
        [BsonElement("DailyReceivedOrders")]
        public int DailyReceivedOrders { get; set; }

        /// <summary>
        /// 总接单数
        /// </summary>
        [BsonElement("TotalReceivedOrders")]
        public int TotalReceivedOrders { get; set; }

        /// <summary>
        /// 满载率
        /// </summary> 
        [BsonElement("FullLoadRatio")]
        public decimal FullLoadRatio { get; set; }
    }
}
